#include "MyFrame.h"
#include <QPainter>
#include <QTimerEvent>

MyFrame::MyFrame(QWidget *parent)
	: QFrame(parent)
{
	timerid=startTimer(800);
	flag=1;
}

MyFrame::~MyFrame()
{

}


void MyFrame::paintEvent(QPaintEvent *event)
{
	QPainter painter(this);
	painter.setPen(QColor(0,0,0));
	if (flag)
	{
		painter.setBrush(QBrush(QColor(2,255,255)));
		flag=0;
	}
	else
	{
		painter.setBrush(QBrush(QColor(125,125,10)));
		flag=1;
	}
	painter.drawEllipse(0,0,30,30);
}

void MyFrame::timerEvent(QTimerEvent *event)
{
	if (timerid==event->timerId())
	{
		update();
	}
}
